/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package billing;

import billing.My_Model;
import java.util.Iterator;
import java.util.Vector;
import java.util.HashMap;
import java.util.List;

/**
 *
 * @author apple
 */
public class ProductModel extends My_Model{
    
    String id;
    String name;
    String unit_price;
    String type;
    String size;
    String discount;
    String supplier_id;
    
    public ProductModel() throws Exception{
        this.tableName = "products";
    }

    @Override
    public My_Model to_model(HashMap<String, String> data) throws Exception {
        ProductModel model = new ProductModel();
        model.id = (data.get("id") != null ) ? data.get("id") : "";
        model.name = (data.get("name") != null ) ? data.get("name") : "";
        model.unit_price = (data.get("unit_price") != null ) ? data.get("unit_price") : "";
        model.size = (data.get("size") != null ) ? data.get("size") : "";
        model.type = (data.get("type") != null ) ? data.get("type") : "";
        model.discount = (data.get("discount") != null ) ? data.get("discount") : "";
        model.supplier_id = (data.get("supplier_id") != null ) ? data.get("supplier_id") : "";
        
        return model;
    }

    
    
}
